﻿
namespace Patterns4Net.PatternEnforcer.Core
{
    /// <summary>
    /// Contains all error messages used by pattern checkers.
    /// </summary>
    public static class ErrorMessages
    {
        #region Immutable
        public const string ChangesInternalStateOfThis = @"Method {0} changes field {1}.";

        public const string ChangesInternalStateOfParam = @"Method {0} changes field {1} of one of it's parameters.";

        public const string ChangesInternalStateOfField = @"Method {0} changes internal state of field {1}.";

        public const string ImmutablePublicFieldMustBeReadOnly =
            @"Field {0} in type {1} is public and since {1} implements Immutable {0} must be marked as readonly.";
        #endregion

        #region Strategy
        public const string StrategyShouldHaveMethod = @"Strategy {0} should have one public method.";

        public const string StrategyMethodShouldBeOverrideable = @"The strategy method {0} in class {1} should be abstract or virtual.";
        #endregion

        #region SimpleFactoryMethod

        public const string SimpleFactoryMethodShouldNotBeVoid = @"Simple factory method {0} must not be void in type {1}.";

        #endregion

        #region NullObject

        public const string NullObjectShouldBeSubclassOrImplementInterface =
            @"Class {0} should be derived from different class than System.Object or should implement some interface.";

        public const string TypeDoesNotOverrideMethod = @"Class {0} should override method {1}.";

        public const string MethodIsTooComplex =
            @"The body of method {0} in class {1} seems to be too complex.";

        #endregion

        #region Composite

        public const string CompositeDoesNotImplementComponentInterface =
            @"The class {0} does not implement component's interface {1}.";

        public const string CompositeDoesNotContainComponentsCollection =
            @"The class {0} should contain a generic collection of components (e.g. IEnumerable<{1}>) as one of it's fields.";

        public const string CompositeMethodDoesNotIterateThruComponents =
            @"The composite method {0} in class {1} seems not to iterate through the collection of components. " +
            @"Try using foreach loop or Linq extension methods to process the collection.";

        #endregion

        #region TemplateMethod

        public const string TemplateMethodShouldBeInNonSealedType =
            @"The method {0} in type {1} could not be template method, because {1} is sealed.";

        public const string TemplateMethodDoesNotCallAnyOverrideableMethod =
            @"The method {0} in type {1} does not make any call to an abstract or virtual method or other template method.";

        #endregion

        #region FactoryMethod

        public const string FactoryMethodCannotBeVoid = @"Factory method {0} (type {1}) cannot be of type void.";

        public const string FactoryMethodCannotBeSealed = @"Factory method {0} (type {1}) must be virtual or abstract.";

        public const string FactoryMethodCannotBeInSealedType = @"The type {0}, which contains factory method, cannot be sealed.";

        #endregion

        #region Prototype

        public const string PrototypeDoesNotImplementICloneable =
            @"The class {0} does not implement interface ICloneable.";

        #endregion

        #region Singleton

        public const string SingletonMustHaveAPrivateCtor = @"Singleton class {0} must have a private constructor.";

        public const string SingletonImplementationIsNotValid =
            @"Singleton implementation in the class {0} is not valid. See a manual for supported singleton implementations.";

        public const string SingletonClassDoesNotContainStaticInstanceField =
            @"Class {0} does not contain static field of a type {0}. See a manual for supported singleton implementations.";

        public const string SingletonContainsMoreThanOneCallToConstructor =
            @"Class {0} contains more than one call to its constructor in its methods bodies. See a manual for supported singleton implementations.";

        #endregion

        #region Wrappers

        public const string WrapperDoesNotContainWrappedType =
            @"The class {0} should contain a field of the wrapped type {1}.";

        public const string WrapperDoesNotImplementTarget = 
            @"The class {0} should implement {1}.";

        public const string ProxyRealSubjectDoesNotImplementSubject =
            @"If the RealSubject ({0}) of the Proxy pattern is provided, it should implement or inherit the Subject ({1}).";

        #endregion

        #region Visitor

        public const string VisitorImplementationWasNotRecognized =
            @"Visitor implementation should be classical (with many 'Visit' overloaded methods) or " +
            @"reflectional (with one visit method with object or dynamic as a parameter). For more info see the documentation.";

        public const string VisitorAcceptAttributeCannotBeOnMoreMethods =
            @"VisitorAccept attribute cannot be on more than one method in clas {0}.";

        public const string VisitorAcceptAttributeWithIsReflectiveTrueCannotBeOnMoreThanOneMethod =
            @"VisitorAccept with IsReflective = true cannot be in more than one visiteable elements.";

        #endregion
    }
}
